package com.sixth.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @program: ssm
 * @description:
 * @author: 高振杨
 * @create: 2021-12-10 15:27
 **/

public class WebUtil {
    public static HttpSession getSession(){
        HttpSession session = getRequest().getSession();
        return session;
    }

    public static HttpServletRequest getRequest(){
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return request;
    }
}
